/**
 * Copyright (C), 2020-2021 by colley.ma
 * File Name: Async.java
 * Encoding: UTF-8
 * Date: 2021年3月31日 上午10:44:03
 * History:
*/
package com.swak.frame.config;

/**
 * 
 * 
 * mars.frame.threadpool.core_pool_size=20
 * mars.frame.threadpool.max_pool_size=60
 * mars.frame.threadpool.queue_capacity=100
 * 
 * ClassName: AsyncProperties.java
 * 
 * @author colley.ma
 * @date 2021年3月31日 上午11:28:25
 */
public class AsyncProperties {
	private final static int DEFAULT_CORE_POOL_SIZE = 10;

	private final static int DEFAULT_MAX_POOL_SIZE = 60;

	private final static int DEFAULT_QUEUE_CAPACITY = 1000;

	private int corePoolSize;
	private int maxPoolSize;
	private int queueCapacity;

	public int getCorePoolSize() {
		if (corePoolSize <= 1) {
			return DEFAULT_CORE_POOL_SIZE;
		}
		return corePoolSize;
	}

	public void setCorePoolSize(int corePoolSize) {
		this.corePoolSize = corePoolSize;
	}

	public int getMaxPoolSize() {
		if (maxPoolSize < 5) {
			return DEFAULT_MAX_POOL_SIZE;
		}
		return maxPoolSize;
	}

	public void setMaxPoolSize(int maxPoolSize) {
		this.maxPoolSize = maxPoolSize;

	}

	public int getQueueCapacity() {
		if (queueCapacity < 10) {
			return DEFAULT_QUEUE_CAPACITY;
		}
		return queueCapacity;
	}

	public void setQueueCapacity(int queueCapacity) {
		this.queueCapacity = queueCapacity;
	}
}
